<template>
  <div id="myChart" :style="{width: '100%', height: '80%'}"></div>
</template>

<script>
  import * as echarts from 'echarts'
  export default {
    name: "Echart1",
    data () {
      return {
        msg: 'Welcome to Your Vue.js App'
      }
    },
    mounted(){
      this.$nextTick(function() {
        this.drawLine();
      })
    },
    methods: {
      drawLine(){
        // 基于准备好的dom，初始化echarts实例
        console.log(echarts)
        console.log(echarts)
        console.log(echarts)
        let myChart = echarts.init(document.getElementById('myChart'))
        // 绘制图表
        myChart.setOption({
          title: { text: '专业就业人数统计' },
          tooltip: {},
          xAxis: {
            data: ["衬衫","羊毛衫","雪纺衫","裤子","高跟鞋","袜子"]
          },
          yAxis: {},
          series: [{
            name: '职业',
            type: 'bar',
            data: [5, 20, 36, 10, 10, 20]
          }]
        });
      }
    }
  }
</script>

<style scoped>

</style>